#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<string>

using namespace std;

//int main()
//{
//	const int a = 10;
//	int* p = (int*)(&a);
//	*p = 20;
//	cout << a << " " << *p << endl;
//	return 0;
//}

string compressString(string S) {
    string res;
    int n = S.size(), count = 0;
    for (int i = 0; i < n;)
    {
        res += S[i];
        int j;
        for (j = i; j < n; j++)
        {
            if (S[i] == S[j]) count++;
            else break;
        }
        res += to_string(count);
        count = 0;
        i = j;
    }
    if (res.size() >= n)return S;
    return res;
}